<template>
	<view class="invite-friends-view">
		<view class="share-view">
			<image class="share-view-image" :src="share" mode=""></image>
			<view class="share-view-text"  @click="copyTextarea(userInfo.sn)">邀请码:{{userInfo.sn}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				share:'',
				userInfo:{}
			}
		},
		onShow() {
			this.getshare()
			this.getUserInfo()
		},
		methods:{
			getshare(){
				this.$http.post(this.$api.getshare,{},{token:true}).then(res=>{
					if(res.code == 1){
						this.share = this.$api.uploadImage +  res.data.share
					}
				})
			},
			getUserInfo() {
				this.$http.post(this.$api.getUserInfo, {}, {
					token: true
				}).then(res => {
					this.userInfo = res.data
				})
			},
			copyTextarea(textValue){
				this.$tools.copyTextarea(textValue)
			}
		}
	}
</script>

<style lang="scss">
	.invite-friends-view{
		height: 90vh;
		background: url('@/static/app/01.png')no-repeat;
		background-size: 100% 100%;
		overflow: hidden;
		position: relative;
	}
	.share-view{
		display: flex;
		align-items: center;
		justify-content: center;
		// flex-direction: column;
		position: absolute;
		bottom: 150rpx;
		left: 180rpx;
	}
	.share-view-image{
		width: 130rpx;
		height: 130rpx;
		margin-right: 30rpx;
	}
	.share-view-text{
		margin-top: 30rpx;
		font-size: 20px;
		color: #ffffff;
	}
</style>